<?php
	namespace Home\Controller;
	use Think\Controller;

	class BrowseController extends Controller {

		public function browse() {
			if (isset($_SESSION['uid'])) {
				// var_dump($_SESSION);
				$_SESSION['url'] = $_SERVER['PHP_SELF'];
				$condition = 1;
				$this->assign('username', $_SESSION['username']);
			}
			else {
				$condition = 0;
			}
			$result = M('search')->select();
			if($result) {
				// var_dump($result);
				$this->assign('result', $result);
			}
			$whichTag = 1;
			$this->assign('whichTag', $whichTag);
			$this->assign('condition', $condition);
			$this->display();
		}

		public function primerDetail() {
			if (I('get.primerid')) {
				$where['primerid'] = I('get.primerid');
				// var_dump($where);
				$result = M('search')->where($where)->select();
				if ($result) {
					// var_dump($result);
					$this->assign('whichTag', 2);
					$this->assign('primerid', $where['primerid']);
					$this->assign('result', $result);
					$this->display();	
				}
			}
		}

	}

?>